#include <linux/uaccess.h>
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/kernel_stat.h>
#include <linux/platform_device.h>
#include <linux/kobject.h>
#include <linux/sysfs.h>
#include <linux/in.h>
#include <net/neighbour.h>
#include <net/arp.h>
#include <linux/if_arp.h>   /** type  */
#include <net/ip.h>
#include <net/netevent.h>
#include <net/route.h>
#include <net/ip_fib.h>
#include <linux/types.h>
#include <linux/netdevice.h>
#include <linux/netlink.h>
#include <linux/inetdevice.h>
#include <linux/list.h>
#include <linux/rcupdate.h>
#include <linux/export.h>
#include <net/tcp.h>
#include <net/fib_rules.h>

#include <uapi/linux/rtnetlink.h>

struct myfib_alias {
	struct hlist_node	fa_list;
	int			fa_type;
};

static HLIST_HEAD(leaf);

int myprobe(struct platform_device *pdev) {
	struct myfib_alias *each;
	struct myfib_alias a1 ={.fa_type =1,} ;
	struct myfib_alias a2 ={.fa_type =20,} ;
	struct myfib_alias a3 ={.fa_type =3000,} ;
	struct myfib_alias a4 ={.fa_type =4567,} ;

	hlist_add_head(&a1.fa_list,&leaf);
	hlist_add_head(&a2.fa_list,&leaf);
	hlist_add_head(&a3.fa_list,&leaf);
	hlist_add_head(&a4.fa_list,&leaf);

	hlist_for_each_entry(each,&leaf,fa_list){
		pr_info("type: %d \n",each->fa_type);
	}
	return 0;
}

int myremove(struct platform_device *pdev) {
	pr_info("myplatformdriver myremove \n");
	return 0;
}

struct of_device_id my_of_match_table =
		{ .compatible = "my_platform_device_003", };

struct platform_driver my_platform_driver = { .driver = { .of_match_table =
		&my_of_match_table, .name = "my-platform-driver", .owner =
THIS_MODULE, }, .probe = myprobe, .remove = myremove, };

module_platform_driver(my_platform_driver);

MODULE_LICENSE("GPL");
MODULE_AUTHOR("Andy");
MODULE_DESCRIPTION("andy one-key driver");
MODULE_ALIAS("one-key");

